Imports System
Imports System.Configuration
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports ASPNET.StarterKit.BusinessLogicLayer

Namespace ASPNET.StarterKit.DataAccessLayer

    Public MustInherit Class DataAccess

        Protected ReadOnly Property ConnectionString() As String

            Get

                Dim connStr As String = ""

                If Not ConfigurationManager.ConnectionStrings("LocalSqlServer") Is Nothing Then
                    connStr = ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString
                End If

                If String.IsNullOrEmpty(connStr) Then
                    Throw New NullReferenceException("ConnectionString configuration is missing from you web.config. It should contain  <connectionStrings> <add key=""LocalSqlServer"" value=""Server=(local);Integrated Security=True;Database=Issue_Tracker"" </connectionStrings>")
                Else
                    Return connStr
                End If

            End Get

        End Property

        'Category
        Public MustOverride Function CreateNewCategory(ByVal newCategory As Category) As Integer
        Public MustOverride Function DeleteCategory(ByVal categoryId As Integer) As Boolean
        Public MustOverride Function GetAllCategories() As List(Of Category)
        Public MustOverride Function GetCategoryByCategoryId(ByVal Id As Integer) As Category
        Public MustOverride Function GetCategoriesByProjectId(ByVal projectId As Integer) As List(Of Category)
        Public MustOverride Function GetCategoryByCategoryNameandProjectId(ByVal categoryName As String, ByVal projectId As Integer) As Category
        Public MustOverride Function UpdateCategory(ByVal newCategory As Category) As Boolean

        'TimeEntry
        Public MustOverride Function CreateNewTimeEntry(ByVal newTimeEntry As TimeEntry) As Integer
        Public MustOverride Function DeleteTimeEntry(ByVal timeEntryId As Integer) As Boolean
        Public MustOverride Function GetAllTimeEntries() As List(Of TimeEntry)
        Public MustOverride Function GetTimeEntries(ByVal projectId As Integer, ByVal userName As String) As List(Of TimeEntry)
        Public MustOverride Function GetTimeEntryById(ByVal timeEntryId As Integer) As TimeEntry
        Public MustOverride Function GetTimeEntriesByUserNameAndDates(ByVal userName As String, ByVal startingDate As DateTime, ByVal endDate As DateTime) As List(Of TimeEntry)
        Public MustOverride Function UpdateTimeEntry(ByVal timeEntry As TimeEntry) As Boolean

        ' Project
        Public MustOverride Function AddUserToProject(ByVal projectId As Integer, ByVal userName As String) As Boolean
        Public MustOverride Function CreateNewProject(ByVal newProject As Project) As Integer
        Public MustOverride Function DeleteProject(ByVal projectID As Integer) As Boolean
        Public MustOverride Function DisableProject(ByVal projectID As Integer) As Boolean
        Public MustOverride Function EnableProject(ByVal projectID As Integer) As Boolean
        Public MustOverride Function GetAllProjects() As List(Of Project)
        Public MustOverride Function GetAllDisabledProjects() As List(Of Project)
        Public MustOverride Function GetProjectById(ByVal projectId As Integer) As Project
        Public MustOverride Function GetProjectsByManagerUserName(ByVal userName As String) As List(Of Project)
        Public MustOverride Function GetProjectMembers(ByVal Id As Integer) As List(Of String)
        Public MustOverride Function GetProjectsByUserName(ByVal userName As String) As List(Of Project)
        Public MustOverride Function RemoveUserFromProject(ByVal projectId As Integer, ByVal userName As String) As Boolean
        Public MustOverride Function UpdateProject(ByVal projectToUpdate As Project) As Boolean

        'User report
        Public MustOverride Function GetUserReportsByProjectId(ByVal projectId As Integer) As List(Of UserReport)
        Public MustOverride Function GetUserReportsByCategoryId(ByVal categoryId As Integer) As List(Of UserReport)

        ' UserTotalDurationReport
        Public MustOverride Function GetUserReportsByUserName(ByVal userName As String) As List(Of UserTotalDurationReport)

        ' Application Setings
        Public MustOverride Function GetAppSetting(ByVal key As String) As String
        Public MustOverride Function SetAppSetting(ByVal key As String, ByVal value As String) As String


    End Class
  
End Namespace
